import 'package:cached_network_image/cached_network_image.dart';
import 'package:flustars/flustars.dart';
import 'package:flutter/material.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBEngineer/YBBaseRouter/YBApplication.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/YBColor/YBColor.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/YBImageStyle/YBImageStyle.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/YBTextStyle/YBTextStyle.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBJsonToModel/YBWorkTaiModel/YBWorkTaiReMenModel.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBModule/YBWorkTaiModule/YBFenXiangHuKePage/YBHuKeSubPage/YBHuKeFenXiangInfoSubPage.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBNetWorkModule/YBAPi/YBAPi.dart';

class YBHukeSmallImageSubPage extends StatelessWidget {

  final YBWorkTaiRemenModel reMenModel;

  const YBHukeSmallImageSubPage({Key key, this.reMenModel}) : super(key: key);

  @override
  Widget build(BuildContext context) {
     bool isTrue = false;
     if (reMenModel != null){
       if (reMenModel.showType != null){
         if (reMenModel.showType.contains('no_img')) {
           isTrue = false;
          }else{
           isTrue = true;
         }
       }
     }
    return Container(
      child: InkWell(
        child: Column(
          children: [
            Container(
              color: YBColor.white,
              child: Padding(
                padding:EdgeInsets.only(left:YBTextStyle.adapterSize20,right:YBTextStyle.adapterSize20,top:YBTextStyle.adapterSize10,bottom:YBTextStyle.adapterSize10),
                child: Column(
                  children: [
                    Container(
                      height: ScreenUtil.getInstance().getAdapterSize(10),
                    ),
                    Container(
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceAround,
                        crossAxisAlignment: CrossAxisAlignment.center,
                        children: [
                          Expanded(
                            child:Column(
                              mainAxisAlignment: MainAxisAlignment.start,
                              crossAxisAlignment: CrossAxisAlignment.start,
                              children: [
                                Container(
                                  child: Text(reMenModel.title??"",style: YBTextStyle.TextStyle30313315Semibold,maxLines: 2,),
                                ),
                                Container(
                                  height: YBTextStyle.adapterSize10,
                                ),
                                Container(
                                  child: isTrue?null:Column(
                                    children: [
                                      Container(
                                        child: Text(reMenModel.content??"",style: YBTextStyle.TextStyle7A7A7A12,maxLines: 2,),
                                      ),
                                      Container(
                                        height: YBTextStyle.adapterSize10,
                                      ),
                                    ],
                                  ),
                                ),
                                Container(
                                  child: YBHuKeFenXiangInfoSubPage(shareNumberStr: reMenModel.shareNumber.toString(),),
                                ),
                              ],
                            ),
                          ),
                          Container(
                            width: isTrue?YBTextStyle.adapterSize15:0,
                          ),
                          Container(
                            child:isTrue?ClipRRect(
                              borderRadius: BorderRadius.circular(YBTextStyle.adapterSize8),
                              child: CachedNetworkImage(imageUrl:'${YBApi.Base_image_URL}/${reMenModel.imageUrl}',fit: BoxFit.cover,height:YBTextStyle.adapterSize80, width:YBTextStyle.adapterSize80,),
                            ):null,
                          ),
                        ],
                      ),
                    ),
                  ],
                ),
              ),
            ),
            Container(
              height:YBTextStyle.adapterSize10,
            ),
          ],
        ),
        onTap: () async {
          YBApplication.router.navigateTo(context, '/workTaiPage/workTaiMyInfoDetailPage?id=${reMenModel.id}&&title=${Uri.encodeComponent(reMenModel.title)}&&descirtion=${Uri.encodeComponent(reMenModel.subTitle)}');
        },
      ),
    );
  }
}
